import { useTable, LIST_TYPE } from '@crud/index';
import { investCalendarList as getList } from '@/api/crm-kgj/calendar';

/** 订单类型 */
export const yearTypeOptions = [
  { label: '不限', value: '' },
  { label: '2025', value: '2025' }
];

/** 月份类型 */
export const monthTypeOptions = [
  { label: '不限', value: '' },
  { label: '1月', value: '01' },
  { label: '2月', value: '02' },
  { label: '3月', value: '03' },
  { label: '4月', value: '04' },
  { label: '5月', value: '05' },
  { label: '6月', value: '06' },
  { label: '7月', value: '07' },
  { label: '8月', value: '08' },
  { label: '9月', value: '09' },
  { label: '10月', value: '10' },
  { label: '11月', value: '11' },
  { label: '12月', value: '12' }
];

/** 弹窗订单类型 */
export const yearTypeDrawerOptions = [
  { label: '2025', value: '2025' }
];

/** 弹窗月份类型 */
export const monthTypeDrawerOptions = [
  { label: '1月', value: '01' },
  { label: '2月', value: '02' },
  { label: '3月', value: '03' },
  { label: '4月', value: '04' },
  { label: '5月', value: '05' },
  { label: '6月', value: '06' },
  { label: '7月', value: '07' },
  { label: '8月', value: '08' },
  { label: '9月', value: '09' },
  { label: '10月', value: '10' },
  { label: '11月', value: '11' },
  { label: '12月', value: '12' }
];

export const useTableList = (options: any = {}) => {
  const columns = [
    {
      label: '月份',
      prop: 'month',
      align: 'center',
      width: 120
    },
    {
      label: '商品品类',
      prop: 'category',
      width: 140,
      align: 'center'
    },
    {
      label: '售价',
      prop: 'price',
      type: 'priceCent',
      align: 'right',
      width: 120
    },
    {
      label: '周期销量',
      prop: 'sales',
      align: 'right',
      width: 120
    },
    {
      label: '选品理由&商品卖点',
      prop: 'sale_point',
      showOverflowTooltip: true,
      align: 'center',
      minWidth: 240
    },
    {
      label: '品类信息',
      render: 'category_goods',
      align: 'left',
      minWidth: 240
    },
    {
      label: '橱窗数/出单数',
      render: 'order_num',
      align: 'center',
      width: 140
    },
    {
      label: '生效数',
      prop: 'effect_num',
      align: 'center',
      sortable: 'custom',
      width: 140
    },

    {
      label: '操作',
      prop: 'sales_name',
      render: 'actions',
      width: 120,
      fixed: 'right',
      align: 'center'
    }
  ];

  return useTable({
    ...options,
    type: LIST_TYPE.KGJ,
    params: {
      keyword: '',
      year: '',
      month: ''
    },
    getParams: ({ ...params }) => {

      return {
        ...params
        // ...formatParamsSelectVal([['channel', -1], ['sales_id', '']], params)
      };
    },
    columns,
    getList
  });
};
